<template>
    <div class='recent'>
        <header class="header">
            <van-nav-bar title="最近播放" left-arrow :border="false" fixed @click-left="handler" :style="{ color: '#fff' }">
                <template #right>
                </template>
            </van-nav-bar>
        </header>
        <scroll>
            <div class="tit">
                <van-tabs v-model="active">
                    <van-tab title="歌曲"><resent-conte :secentList="secentList"></resent-conte></van-tab>
                    <van-tab title="视频"><resent-video></resent-video></van-tab>
                    <van-tab title="声音"><resent-conte :secentList="secentList"></resent-conte></van-tab>
                    <van-tab title="歌单"><resent-conte :secentList="secentList"></resent-conte></van-tab>
                </van-tabs>
            </div>
        </scroll>
    </div>
</template>

<script>
import { getRecent } from "@/api/index.js"
import scroll from "../public/scroll.vue"
import resentConte from "./resentCon.vue"
import resentVideo from "./resentVido"
import { mapState } from "vuex"
export default {
    name: 'recent',
    data() {
        return {
            secentList: [],
            active: 0,
        }
    },
    computed: {
        ...mapState(['cookie'])
    },
    components: { scroll, resentConte, resentVideo },
    created() { },
    async beforeMount() {
        if (!this.cookie) {
            this.$router.go(-1)
        } else {
            var { data } = await getRecent(this.cookie)
            this.secentList = data.data.list
        }
    },
    mounted() { },
    methods: {
        handler() {
            this.$router.go(-1)
        }
    }
}
</script>
<style scoped>
hr {
    width: 98%;
    background: #eee;
    margin: 0 auto;
}

p {
    margin: 5px;
}

h3 {
    font-weight: normal;
    color: #1989fa;
    margin: 5px;
    font-size: 16px;
}

.tit {
    padding: 50px 20px 0;

}

.list {
    padding: 50px 20px 0;
}

.mod-p {
    font-size: 12px;
}

.mod-r {
    display: flex;
    align-self: center;
}

.box>.title {
    display: flex;
    justify-content: space-between;
}

.box {
    width: 80%;
    margin: 10px auto;
    background-color: #fff;
    border-radius: 15px;
    padding: 10px 20px;
}

.title>button {
    border: 1px solid red;
    border-radius: 20px;
    color: red;
    background-color: #fff;
    font-size: 12px;
}

.mod {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.mod .van-icon {
    margin-left: 30px;
    font-size: 22px;
}
</style>
